home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / DatagramSocketImpl.java < prev    next >
Text File  |  1998-09-22  |  3KB  |  120 lines

  1. /*
  2.  * @(#)DatagramSocketImpl.java    1.11 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.net;
  16.  
  17. import java.io.FileDescriptor;
  18. import java.io.IOException;
  19. import java.io.InterruptedIOException;
  20.  
  21. /**
  22.  * Abstract datagram and multicast socket implementation base class.
  23.  * @author Pavani Diwanji
  24.  * @since  JDK1.1
  25.  */
  26.  
  27. public abstract class DatagramSocketImpl implements SocketOptions {
  28.     protected int localPort;
  29.  
  30.     /**
  31.      * The file descriptor object
  32.      * @since   JDK1.1
  33.      */
  34.     protected FileDescriptor fd;
  35.  
  36.  
  37.     /**
  38.      * Creates a datagram socket
  39.      * @since   JDK1.1
  40.      */
  41.     protected abstract void create() throws SocketException;
  42.  
  43.     /**
  44.      * Binds a datagram socket to a local port and address.
  45.      * @since   JDK1.1
  46.      */
  47.     protected abstract void bind(int lport, InetAddress laddr) throws SocketException;
  48.  
  49.     /**
  50.      * Sends a datagram packet. The packet contains the data and the
  51.      * destination address to send the packet to.
  52.      * @param packet to be sent.
  53.      * @since   JDK1.1
  54.      */
  55.     protected abstract void send(DatagramPacket p) throws IOException;
  56.  
  57.     /**
  58.      * Peek at the packet to see who it is from.
  59.      * @param return the address which the packet came from.
  60.      * @since   JDK1.1
  61.      */
  62.     protected abstract int peek(InetAddress i) throws IOException;
  63.  
  64.     /**
  65.      * Receive the datagram packet.
  66.      * @param Packet Received.
  67.      * @since   JDK1.1
  68.      */
  69.     protected abstract void receive(DatagramPacket p) throws IOException;
  70.  
  71.     /**
  72.      * Set the TTL (time-to-live) option.
  73.      * @param TTL to be set.
  74.      * @since   JDK1.1
  75.      */
  76.     protected abstract void setTTL(byte ttl) throws IOException;
  77.  
  78.     /**
  79.      * Retrieve the TTL (time-to-live) option.
  80.      * @since   JDK1.1
  81.      */
  82.     protected abstract byte getTTL() throws IOException;
  83.  
  84.     /**
  85.      * Join the multicast group.
  86.      * @param multicast address to join.
  87.      * @since   JDK1.1
  88.      */
  89.     protected abstract void join(InetAddress inetaddr) throws IOException;
  90.  
  91.     /**
  92.      * Leave the multicast group.
  93.      * @param multicast address to leave.
  94.      * @since   JDK1.1
  95.      */
  96.     protected abstract void leave(InetAddress inetaddr) throws IOException;
  97.  
  98.     /**
  99.      * Close the socket.
  100.      * @since   JDK1.1
  101.      */
  102.     protected abstract void close();
  103.  
  104.     /**
  105.      * Get the local port.
  106.      * @since   JDK1.1
  107.      */
  108.     protected int getLocalPort() {
  109.     return localPort;
  110.     }
  111.  
  112.     /**
  113.      * Get the datagram socket file descriptor
  114.      * @since   JDK1.1
  115.      */
  116.     protected FileDescriptor getFileDescriptor() {
  117.     return fd;
  118.     }
  119. }
  120.